package filecheck;

import java.io.*;

/**
 * Created by lawrence on 2015/8/6.
 */
public class RemoveDuplicateRows {
    public static void main(String[] arg0) {

        BufferedReader fis;
        BufferedWriter bw;
        try {
            fis = new BufferedReader(
                    new InputStreamReader(new FileInputStream(new File("D://data_tj_DaYueCheng_dhdb_sishb_20150817T113308_3934.wifi"))));
            File outPutFile = new File("D://wifiCollection_old2.wifi");
            if (!outPutFile.exists()) {
                outPutFile.createNewFile();
            } else {
                outPutFile.delete();
                outPutFile.createNewFile();
            }
            bw = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(outPutFile)));
            String lastLine = "";
            String line = fis.readLine();
            while (line != null) {
//                System.out.println(line);
                if (line.length() > 0 && line.contains(" ")) {
                    if (lastLine.equals(line.substring(line.indexOf(" ")))) {

                    } else {
//                        System.out.println(lastLine);
                        bw.write(lastLine.substring(lastLine.lastIndexOf(" ") + 1));
//                        bw.write("\n");
                        if(lastLine.contains("-")) {
                            String []  count = lastLine.split("-");
                            bw.write("   Scan Value =" + (count.length - 3));
                        }
                        bw.write("\n");
                        lastLine = line.substring(line.indexOf(" "));
                    }
                }
                line = fis.readLine();

            }
            bw.flush();
            bw.close();
            fis.close();
        } catch (IOException e) {
            e.printStackTrace();
        }


    }
}
